const db = require('../db/index')

// 根据id获取当前用户的处理函数
exports.getCurrentUser = (req, res) => {
    const sql = `select * from av_users where id = ?`
    db.query(sql, req.params.id, (err, results) => {
        if (err) return res.cc(err)
        if (results.length !== 1) return res.cc('获取用户失败!')
        res.send({
            status: 0,
            code: 20000,
            message: '获取当前用户成功!',
            data: results[0]
        })
    })
}